package com.mapper;

import com.pojo.Consumer;
import com.pojo.requestjson.FaceRecognitionRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 消费者映射器
 *
 * @author 蔡文欣
 * @date 2023/07/08 10:07:31
 */
@Mapper
public interface ConsumerMapper {

    /**
     * 为null
     *
     * @param consumer 消费者
     * @return {@link Consumer}
     */
    Consumer isNull(Consumer consumer);
    @Select("select  consumer_password consumerPassword from Consumer where consumer.consumer_phone=#{phone} and consumer.consumer_facetoken=#{faceToken}")
    Consumer query(@Param("phone") String phone, @Param("faceToken") String faceToken);
@Update("update Consumer set consumer_password ='c24e3945784b8361d27f12gf6g5ae21e8blb9y06s06dfca5' where consumer.consumer_phone=#{phone}")
        int updatePassword(String phone);
@Update("update Consumer set consumer_password =#{password} where consumer.consumer_phone=#{phone}")
        int byPhoneUpdatePassword(@Param("phone")String phone,@Param("password")String password);
    /**
     * 添加消费者脸
     *
     * @param consumer 消费者
     * @return {@link Integer}
     */
    Integer addConsumerFace(FaceRecognitionRequest consumer);

    /**
     * 按id选择
     *
     * @param id id
     * @return {@link Consumer}
     */
    Consumer byIdSelect(String id);

    /**
     * 添加消费者
     *
     * @param consumer 消费者
     * @return int
     */
    int AddConsumer(Consumer consumer);
}
